Skip to content

android 获取短信内容,读取短信,监听短信 读取所有的短信内容,监听短信 历史短信 来去电监

插件 ID: 23783
来源: https://ext.dcloud.net.cn/plugin?id=23783
android 系统短信读取 读取所有的短信内容,监听短信 监听系统实时短信 读取历史短信 来去电监听 静默发送短信 跳转短信 短信 短信 短信


更新记录

                                                    1.0.9(2026-01-05)

优化

                                                    1.0.8(2025-11-09)

优化 增加短信发送

                                                    1.0.5(2025-11-08)

优化 查看更多

平台兼容性

uni-app(4.15)

| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 | | | √ | √ |

  • |
  • | √ | √ | 5.0 |
  • |
  • | | | 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 | | |
  • |
  • |
  • |
  • |
  • |
  • |
  • |
  • |
  • |
  • |
  • |
  • | |

uni-app x(4.15)

| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 | | |

  • |
  • | 5.0 |
  • |
  • |
  • | |

其他

| 多语言 | 暗黑模式 | 宽屏模式 | | | √ | √ | √ | |

xtf-phonestate

android 来去电监听 监听实时短信,读取历史短信 发送短信

由于系统限制 部分手机无法读取验证码

插件测试使用方法

1.选择试用,绑定要试用的项目appid, 2.选择后下载到对应的本地项目, 3.按照文档 -》把插件引入项目(即

    import { SMSData, SmsOption, onGetSms, onListenerSms, removeSmsListener,onStartListenerPhone, sendSms, jumpSms } from '@/uni_modules/xtf-phonestate';

需要先引入), 4.发布-》云打包-》选择制作基座-》打包等基座制作完成 5.运行 -》 运行到手机或模拟器-》运行到Androidapp基座-》选择使用自定义基座运行-》选择手机-》运行 6.之前若安装过基座 ,请卸载之前的基座 uniappx

<template>
    <view>
        <button type="primary" style="margin: 10rpx;" @click="onClick(0)">开启实时短信监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(1)">取消实时短信监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(2)">读取近一月短信</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(3)">来去电监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(4)">静默发送短信</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(5)">跳转短信应用</button>
    </view>
</template>
<script>
    import { SMSData, SmsOption, onGetSms, onListenerSms, removeSmsListener,onStartListenerPhone, sendSms, jumpSms } from '@/uni_modules/xtf-phonestate';
    export default {
        data() {
            return {
                title: 'Hello'
            }
        },
        onLoad() {
        },
        methods: {
                onClick(id:number){
                    if(id==0){
                        onListenerSms(function(b:SMSData[]){
                            console.log(b);
                        })
                    }else if(id==1){
                        removeSmsListener();
                    }else if(id==2){
                    onGetSms({
                            startDate:"2025-03-01",
                            callback(res:SMSData[]) {
                                console.log(res,res.length);
                            }
                        } as SmsOption)
                        // console.log(JSON.stringify(b));
                    }else if(id==3){
                        onStartListenerPhone(function(state:number,msg:string){
                            console.log(state,msg)
                        })
                    }else if(id==4){
                        sendSms("10001","108",function(state:boolean,msg:string){
                        })
                    }else if(id==5){
                        jumpSms("10001","108");
                    }
                },
        }
    }
</script>
<style>
    .logo {
        height: 100px;
        width: 100px;
        margin: 100px auto 25px auto;
    }
    .title {
        font-size: 18px;
        color: #8f8f94;
    text-align: center;
    }
</style>

uniapp

<template>
    <view>
        <button type="primary" style="margin: 10rpx;" @click="onClick(0)">开启实时短信监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(1)">取消实时短信监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(2)">读取近一月短信</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(3)">来去电监听</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(4)">静默发送短信</button>
        <button type="primary" style="margin: 10rpx;" @click="onClick(5)">跳转短信应用</button>
    </view>
</template>
<script>
    import { SMSData, SmsOption, onGetSms, onListenerSms, removeSmsListener,onStartListenerPhone, sendSms, jumpSms } from '@/uni_modules/xtf-phonestate';
    export default {
        data() {
            return {
                title: 'Hello'
            }
        },
        onLoad() {
        },
        methods: {
                onClick(id){
                    if(id==0){
                        onListenerSms(function(b){
                            console.log(b);
                        })
                    }else if(id==1){
                        removeSmsListener();
                    }else if(id==2){
                    onGetSms({
                            startDate:"2025-03-01",
                            callback(res:SMSData[]) {
                                console.log(res,res.length);
                            }
                        } )
                        // console.log(JSON.stringify(b));
                    }else if(id==3){
                        onStartListenerPhone(function(state,msg){
                            console.log(state,msg)
                        })
                    }else if(id==4){
                        sendSms("10001","108",function(state,msg){
                        })
                    }else if(id==5){
                        jumpSms("10001","108");
                    }
                },
        }
    }
</script>
<style>
    .logo {
        height: 100px;
        width: 100px;
        margin: 100px auto 25px auto;
    }
    .title {
        font-size: 18px;
        color: #8f8f94;
    text-align: center;
    }
</style>

参数介绍

export type SMSData = {
     smsId?:number, // 短信id
     sender?:string,// 短信发送者手机号
     content?:string,// 短信内容
     date?:number,// 短信日期
     type?:number,// 短信类型
     selfChange?:boolean 
}
export type SmsOption = {
    startDate?:string, // 开始日期 格式为2025-06-07
    endDate?:string,// 结束日期 格式为2025-06-07
    type?:number,// 1 为收件 2 发送
    callback?:(s:SMSData[])=>void // 回调发送结果
}

开发文档

UTS 语法UTS API插件UTS uni-app兼容模式组件UTS 标准模式组件Hello UTS

MIT Licensed